﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZealousTTS.Web.Utility;
using ZealousTTS.Domain;
using ZealousTTS.Common.Extensions;
using ZealousTTS.Web.ViewModels;

namespace ZealousTTS.Web.Controllers
{
    public class HomeController : BaseController
    {
        private ZealousTTSEntities _Context;

        public HomeController()
        {
            _Context = new ZealousTTSEntities();
        }

        public HomeController(UserViewModel currentUser)
            : base(currentUser)
        {
            _Context = new ZealousTTSEntities();
        }

        public ActionResult Index()
        {
            return View();
        }

        //public ActionResult Index(String SearchKey = "", String page = null)
        //{
        //    //ViewBag.Message = "Welcome to ASP.NET MVC!";

        //    int pageNo = page.ToInt() > 0 ? page.ToInt() : 1;
        //    UtilityDAO dao = new UtilityDAO();
        //    DbParameter[] parameters = new[] { 
        //        new DbParameter("@CompanyID", 1), 
        //        new DbParameter("@SearchKey", SearchKey) 
        //    };
        //    int totalRecord = 0;
        //    System.Data.DataSet ds = dao.GetPagedData(DbObject.SP.GET_PRODUCT_BY_SEARCH, parameters, pageNo, 10, out totalRecord, true);
        //    ViewBag.PageNumber = pageNo;
        //    ViewBag.PageSize = 10;
        //    ViewBag.TotalRecord = totalRecord;
        //    ViewBag.DataSource = ds;
        //    //ViewBag.ShowEditLink = true;

        //    return View();
        //}

        public ActionResult About()
        {
            return View();
        }

        ///// <summary>
        ///// Gets District Collection By a Country
        ///// </summary>
        ///// <param name="countryID"></param>
        ///// <returns></returns>
        //public String GetDistrictsByCountry(int countryID)
        //{
        //    var query = from P in _Context.Districts
        //                where P.CountryID == countryID
        //                orderby P.Name
        //                select new
        //                {
        //                    ID = P.ID,
        //                    Name = P.Name
        //                };
        //    if (query == null || query.Count() == 0)
        //        return null;
        //    else
        //        return query.ToList().ToJSON();
        //}
    }
}
